package com.newasia.server.shiro;

import org.apache.shiro.crypto.hash.SimpleHash;

public class EncryptionUtil {
    private EncryptionUtil(){}

    public final static String HASH_ALGORITHM_SHA_NAME = "SHA-256";
    public final static String HASH_ALGORITHM_MD5_NAME = "MD5";

    public final static int HASH_ITERATIONS = 1;

    public static String sha256(String password,String salt){
        return new SimpleHash(HASH_ALGORITHM_SHA_NAME,password,salt,HASH_ITERATIONS).toString();
    }

    public static String md5(String password){
        return new SimpleHash(HASH_ALGORITHM_MD5_NAME,password).toString();
    }
}
